package com.budwk.app.sqfwV2.service.entrepreneurShipHouse;

import com.alibaba.fastjson.JSONObject;
import com.budwk.app.sqfw.enums.SupportBusinessTypeEnum;
import com.budwk.app.sqfw.vo.GenerateExcelUrlVO;
import com.budwk.app.sqfwDoc.bo.ExcelCreateConfig;
import com.budwk.app.sqfwDoc.codeGenerator.excelGenerate.BaseExcelParamDTO;
import com.budwk.app.sqfwDoc.codeGenerator.excelGenerate.BaseTemplateExcelGenerator;
import com.budwk.app.sqfwDoc.codeGenerator.excelGenerate.ExcelGeneratorConfig;
import com.budwk.app.sqfwDoc.codeGenerator.impl.SqfwTemplateExcelCommonService;
import com.budwk.app.sqfwDoc.codeGenerator.pdfGenerate.AbstractCustomerPdfCreateField;
import com.budwk.app.sqfwV2.dto.dto.EntrepreneurShipHouseParamDTO;
import com.budwk.app.sqfwV2.enums.EntrepreneurHouseFileEnum;
import org.nutz.ioc.loader.annotation.IocBean;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author 东方祥云低代码1.1
 * @since 2024-04-26
 *
 * 创业实体入户 EntrepreneurShipHouse
 */
@IocBean
public class EntrepreneurShipHouseExcelService extends SqfwTemplateExcelCommonService {

    @Override
    public List<GenerateExcelUrlVO> generateExcel(List<ExcelCreateConfig> excelConfigList, String userId, List<String> sqfwIdList) {
        return super.generateExcel(excelConfigList, userId, sqfwIdList);
    }

    @Override
    protected void customerPopularBaseExcelParam(BaseExcelParamDTO baseExcelParam, String userId, List<String> sqfwIdList) {

    }

    @Override
    protected void customerPopularBaseExcelParamForAdmin(BaseExcelParamDTO baseExcelParam, String userId, List<String> formSummaryNewIdList) {

    }

    @Override
    protected List<ExcelGeneratorConfig> getExcelCodeGeneratorConfig(List<ExcelCreateConfig> excelConfigList, BaseExcelParamDTO baseExcelParam) {
        if (excelConfigList.size() == 0) {
            return Collections.emptyList();
        }
        List<ExcelGeneratorConfig> list = new ArrayList<>();
        for (ExcelCreateConfig config : excelConfigList) {
            ExcelGeneratorConfig generatorConfig = new ExcelGeneratorConfig();
            BaseTemplateExcelGenerator service = EntrepreneurHouseFileEnum.getService(config.getFileIdentity());
            generatorConfig.setGenerator(service);
            generatorConfig.setExcelCreateConfig(config);
            list.add(generatorConfig);
        }
        return list;
    }

    @Override
    protected AbstractCustomerPdfCreateField parseParamData(String paramDataStr) {
        return JSONObject.parseObject(paramDataStr, EntrepreneurShipHouseParamDTO.class);
    }

    @Override
    protected String getSqfwFormSummaryType() {
        return SupportBusinessTypeEnum.ENTERPRENEURAL.getName();
    }
}
